﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;

namespace G
{
    /// <summary>
    /// 绑定辅助类
    /// </summary>
    public static class BindingHelp
    {
        public static Binding Create()
        {
            return new Binding();
        }
        public static Binding Create(string path, object source)
        {
            return new Binding()
            {
                Path = new PropertyPath(path),
                Source = source
            };
        }
        /// <summary>
        /// 为绑定设置Converter
        /// </summary>
        /// <param name="binding"></param>
        /// <param name="convert"></param>
        /// <returns></returns>
        public static Binding SetConvert(this Binding binding, IValueConverter convert)
        {
            binding.Converter = convert;
            return binding;
        }
    }
}
